package com.rgs.se.sort;



public class _1Quick3 {
    /*
     * 快速排序之三指针扫描法
     * */
    public static void Quick3(int[] arr,int start,int end){
        int pivot = arr[start];
        int left = start+1;
        int equal = left;
        int right = end;
        if(left > right){
            return;
        }
        while(left <= right){
            if(arr[left] < pivot){
                SortUtil.Temp(arr,left,equal);
                equal++;
                left++;
            }
            else if(arr[left] == pivot){
                left++;
            }
            else if(arr[left] > pivot){
                SortUtil.Temp(arr,left,right);
                right--;
            }
        }
        SortUtil.Temp(arr,start,equal-1);
        Quick3(arr,start,equal-2);
        Quick3(arr,right+1,end);
    }


}
